<template>
  <div class="certificateManagement">
    <Wrapper>
      <div class="search-wrapper">
        <el-input
          v-model="search"
          placeholder="请输入内容"
          prefix-icon="el-icon-search"
          class="search"
        />
        <section>
          <el-button type="primary"><svg-icon icon-class="add" /> 新建模板</el-button>
          <el-select v-model="certificateChoose" multiple filterable placeholder="证书分类筛选">
            <el-option
              v-for="item in certificateType"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </section>
      </div>
      <div />
      <div class="certificate-wrapper">
        <ul>
          <li v-for="item in certificateList" :key="item.id">
            <div class="certificate-item">
              <p class="certificate-title">{{ item.title }}</p>
              <div class="certificate-mask">
                <div class="certificate-mask-tools">
                  <i class="el-icon-edit" title="编辑" />
                  <i class="el-icon-document-copy" title="复制" />
                  <i class="el-icon-delete" title="删除" />
                </div>
                <p class="certificate-preview">预览模板</p>
              </div>
            </div>
            <p class="certificate-name">
              {{ item.title }}
            </p>
          </li>
        </ul>
      </div>
      <el-pagination
        background
        :page-sizes="[8, 16, 32, 64]"
        :page-size="8"
        layout=" prev, pager, next, sizes"
        :total="64"
        @size-change="sizeChange"
      />
    </Wrapper>
  </div>
</template>
<script>
export default {
  data() {
    return {
      search: '',
      certificateChoose: '',
      certificateType: [
        {
          value: '种类一',
          lable: '种类一'
        },
        {
          value: '种类二',
          lable: '种类二'
        },
        {
          value: '种类三',
          lable: '种类三'
        },
        {
          value: '种类四',
          lable: '种类四'
        }
      ],
      certificateList: [
        {
          id: 0,
          title: '奖状0'
        },
        {
          id: 1,
          title: '奖状1'
        },
        {
          id: 2,
          title: '奖状2'
        },
        {
          id: 3,
          title: '奖状3'
        },
        {
          id: 4,
          title: '奖状4'
        },
        {
          id: 5,
          title: '奖状5'
        },
        {
          id: 6,
          title: '奖状6'
        },
        {
          id: 7,
          title: '奖状7'
        }
      ]
    }
  },
  methods: {
    sizeChange(val) {
      const arr = []
      for (let i = 0; i < val; i++) {
        const temp = {
          id: 1,
          title: '奖状一'
        }
        temp.id = i
        temp.title = '奖状' + i
        arr.push(temp)
      }
      this.certificateList = arr
    }
  }
}
</script>
<style lang="scss">
.certificateManagement{
  .main-wrapper{
    max-width: 1620px;
    min-width: 1500px;
  }
    .search-wrapper{
    display: flex;
    justify-content: space-between;
    .search{
      width: 300px;
      margin-bottom: 30px;
    }
    .el-button{
      height: 40px;
      margin-right: 30px;
    }
  }
  .certificate-wrapper{
    >ul{
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      li{
        width: 340px;
        height: 240px;
        margin-bottom: 16px;
        font-size: 14px;
        .certificate-item{
          height: 190px;
          color: #fff;
          text-align: center;
          position: relative;
          background-color: pink;
          &:hover{
            .certificate-mask{
              display: block;
            }
          }
          .certificate-title{
            display: inline-block;
            border-radius: 6px;
            height: 30px;
            line-height: 30px;
            margin-top: 140px;
            width: 220px;
            background-color: rgba($color: #000000, $alpha: 0.5);
            color: #fff;
          }
          .certificate-mask{
            display: none;
            position: absolute;
            top: 0px;
            width: 100%;
            height: 100%;
            background-color: rgba($color: #000000, $alpha: 0.5);
            text-align: center;
            .certificate-mask-tools{
              text-align: right;
              font-size: 16px;
              i{
                margin: 10px;
                cursor: pointer;
              }
            }
            .certificate-preview{
              display: inline-block;
              padding: 10px 20px;
              border: 1px solid #fff;
              border-radius: 6px;
              position: absolute;
              top: 50%;
              left: 50%;
              transform: translate(-50%,-50%);
            }
          }
        }
        .certificate-name{
          display: block;
          height: 50px;
          line-height: 50px;
          text-align: center;
          background-color: sandybrown;
        }
      }
    }
  }
  .el-pagination{
    text-align: right;
    margin-top: 30px;
  }
}
</style>
